import {
  createRouter,
  createWebHistory,
  NavigationGuardNext,
  RouteLocationNormalizedGeneric,
  RouteLocationNormalizedLoadedGeneric
} from "vue-router";
import { getWebData } from "../web3";
const router = createRouter({
  history: createWebHistory(),
  // routes: [{
  //     path: '/',
  //     name: 'home',
  //     meta: { 
  //         name:'首页'
  //     },
  //     component: () => import('../views/test1.vue')
  // },
  // {
  //     path: '/two',
  //     name: 'two',
  //     meta: { 
  //         name:'页面2'
  //     },
  //     component: () => import('../views/test2.vue')
  // },
  // {
  //     path: '/login',
  //     name: 'login',
  //     meta: { 
  //         name:'登录'
  //     },
  //     component: () => import('../views/login.vue')
  // },
  // {
  //     path: '/chart',
  //     name: 'chart',
  //     meta: { 
  //         name:'图表'
  //     },
  //     component: () => import('../views/test3.vue')
  // }]
  routes: [{
    path: '/', name: 'Layout', component: () => import('../components/Layout.vue'), redirect: '/market',
    children: [
      { path: '/market', name: 'MarketNft', component: () => import('../views/market/marketNft.vue'), meta: { name: 'NFT商城' } },
      { path: '/pledge', name: 'Pledge', component: () => import('../views/task/pledge.vue'), meta: { name: '质押挖矿' } },
      { path: '/chart', name: 'chart', component: () => import('../views/test3.vue'), meta: { name: '页面3' } },
      { path: '/login', name: 'Login', component: () => import('../views/login.vue'), meta: { name: '页面4' } },
      { path: '/detail', name: 'NftDetail', component: () => import('../views/market/nftDetail.vue'), meta: { name: 'NFT详情' } },
    ]
  }]
})
// router.beforeEach((to: RouteLocationNormalizedGeneric, from: RouteLocationNormalizedLoadedGeneric, next: NavigationGuardNext) => {
//   getWebData(to, from, next);
// });
export default router